#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int* exchange(int* nums, int numsSize, int* returnSize);
void swap(int* nums, int idx1, int idx2);

/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int main()
{
	return 0;
}

int* exchange(int* nums, int numsSize, int* returnSize)
{
	/* [0, odd) [odd, end) */
	int odd = 0, p = 0;
	while (p != numsSize) {
		if (nums[p] & 1) swap(nums, odd++, p++);
		else			 p++;
	}

	return nums;
}

void swap(int* nums, int idx1, int idx2)
{
	int temp = nums[idx1];
	nums[idx1] = nums[idx2];
	nums[idx2] = temp;
}
